const Sequelize = require('sequelize');
/*const sequelize = new Sequelize('dev', 'root', 'Dev123456@', {
    host: 'localhost',
    dialect: 'mysql'/!*|'sqlite'|'postgres'|'mssql'*!/,

    pool: {
        max: 5,
        min: 0,
        acquire: 30000,
        idle: 10000
    },
});*/

let dev = false;
let database = '';
if (dev){
    database = 'dev';
}else {
    database = 'zx-product';
}



const sequelize = new Sequelize(database, 'root', 'Abc123456!', {
    host: '47.106.252.151',
    dialect: 'mysql'/*|'sqlite'|'postgres'|'mssql'*/,

    pool: {
        max: 5,
        min: 0,
        acquire: 30000,
        idle: 10000
    },
});
//验证连接
sequelize
    .authenticate()
    .then(() => {
        console.log('MYSQL 链接成功');
    })
    .catch((error) => {
        console.log('MYSQL链接失败' + error);
    })
module.exports=sequelize
